﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="../lib/html5.js"></script>
    <script type="text/javascript" src="../lib/respond.min.js"></script>
    <script type="text/javascript" src="../lib/PIE_IE678.js"></script>
    <![endif]-->
    <link href="../lib/layui/css/layui.css" rel="stylesheet" type="text/css" />
    <link href="../css/H-ui.min.css" rel="stylesheet" type="text/css" />
    <link href="../css/H-ui.admin.css" rel="stylesheet" type="text/css" />
    <link href="../lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
    <link href="../lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />

    <!--[if IE 6]>
    <script type="text/javascript" src="../lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>在途待入库处理</title>
</head>
<body>
    <div class="pd-5">
        <div class="row cl" id="findfdiv">
            <div class="formControls col-2"></div>
            <div class="formControls col-2">
                <span class="select-box">
                    <select class="select" size="1" name="findtaskfromorgid_dn" id="findtaskfromorgid"></select>
                </span>
            </div>
            <div class="col-2">
                <input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" placeholder="发货时间" id="findinfodt1_times" name="findinfodt1_times" class="input-text Wdate">
            </div>
            <!--         <div class="col-2">
                         <input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" placeholder="发货时间" id="findinfodt1_timee" name="findinfodt1_timee" class="input-text Wdate">
                     </div>-->
            <div class="formControls col-1">
                <input type="text" class="input-text" placeholder="品种名称" id="findfv1" name="findfv1">
            </div>
            <div class="formControls  skin-minimal col-2">
                <div class="check-box">
                    <input type="checkbox" id="c_dcinfo" name="c_dcinfo" value="1" checked="checked" />
                    <label for="c_dcinfo">包含待质检</label>
                </div>
            </div><div class="formControls col-2">
                <button onclick="hcrainpage()" class="btn btn-success radius" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 查询</button>
            </div>
            <!--     <div class="formControls col-3">
                <span class="select-box">
                    <select class="select" size="1" name="findinfofv4" id="findinfofv4">
                        <option value="待入库">待出库</option>
                        <option value="出库中">出库中</option>
                        <option value="已出库">已出库</option>
                        <option value="全部">全部</option>
                    </select></span>
            </div>-->
            <div class="formControls col-6">

                <a href="javascript:;" onclick="opencodelist();" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe645;</i>管理入库条码</a>
                <a href="javascript:;" onclick="ymfun_fbcodeplant();" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe645;</i>预分配码段（按基地+发货时间）</a>
            </div>
        </div>
        <div class="cl pd-5 bg-1 bk-gray mt-5 ">
            <div class="form form-horizontal">
                <div class="row cl" style="margin-top: 0px">
                    <div class="formControls col-2">
                        <span class="select-box">
                            <select class="select" size="1" name="finouttype" id="finouttype">
                                <option value="运输入库">运输入库</option>
                                <option value="退货处理">退货处理</option>
                            </select>
                        </span>
                    </div>
                    <div class="formControls col-2">
                        <input type="text" class="input-text" placeholder="出库说明" id="foutdesc" name="foutdesc">
                    </div>
                    <label class="form-label col-1">入库日期：</label>
                    <div class="formControls col-2">
                        <input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd 00:00:00'})" name="testdataaddtime" id="testdataaddtime" class="input-text Wdate" />
                    </div>
                    <label class="form-label col-2">交接人员：</label>
                    <div class="formControls col-2 layui-form">
                        <select name="inoutusernamesel" id='inoutusernamesel' lay-filter="testselect" lay-verify="required" lay-search="">
                            <option value="">直接选择或搜索选择</option>
                        </select>
                    </div>
                    <div class="formControls col-1"><a href="javascript:;" onclick="savetotaskstre()" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 提交</a></div>
                </div>
            </div>
        </div>
        <div id="hcvueapp" class="mt-5 ml-20">
            <div class="panel panel-default" v-for="site in listinfo">
                <div class="panel-header" style="margin: 0px; padding: 0px;">{{ site.fv1 }}--总量：{{ site.storeall }}</div>
                <div class="panel-body" style="margin: 0px; padding: 0px;">
                    <table class="table table-border table-bordered table-hover" style="margin: 0px; padding: 0px;">
                        <thead>
                            <tr>
                                <th>信息</th>
                                <th>
                                    发货量kg/包/包/包<br />
                                    已处理量kg/包/包/包
                                </th>
                                <th>处理量</th>
                                <th>扣率</th>
                                <!--<th>单价</th><th>小计</th>-->
                                <th>
                                    <div v-if="site.subinfo3.length >0">{{site.subinfo3[0].fv3}}-包</div>
                                </th>
                                <th>
                                    <div v-if="site.subinfo3.length >1">{{site.subinfo3[1].fv3}}-包</div>
                                </th>
                                <th>
                                    <div v-if="site.subinfo3.length >2">{{site.subinfo3[2].fv3}}-包</div>
                                </th>
                                <th>入库量Kg</th>
                                <th>入库框数</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr v-for="worklist in site.subinfo" v-bind:class="{ success: (worklist.hasoutall<=worklist.storeall), 'warning':worklist.hasoutall>=worklist.storeall }">
                                <td>
                                    {{ worklist.taskfromorgname}}-地块：{{ worklist.dkname}}<br />发货：{{ worklist.dataaddtime.Value}}<br />采摘：{{ worklist.taskworktime.Value}}
                                    <br />
                                    {{ worklist.inoutstorestate }}-{{ worklist.productstate }}
                                    <br />是否已预分配码段：{{worklist.hasplantcode}}
                                </td>

                                <td>
                                    {{ worklist.storeall }}/{{ worklist.storefortype1 }}/{{ worklist.storefortype2 }}/{{ worklist.storefortype3 }}
                                    <br />
                                    {{ worklist.hasoutall }}/{{ worklist.storefortype1out }}/{{ worklist.storefortype2out }}/{{ worklist.storefortype3out }}
                                </td>
                                <td>
                                    <input type="number" id="worklist.needtodoid" class="input-text" placeholder="处理量" v-model.number="worklist.needtoout" />
                                </td>
                                <td>
                                    <input type="number" id="worklist.klid" class="input-text" placeholder="扣率" v-model.number="worklist.kl" readonly="true" />
                                </td>

                                <!--    <td>
                                       <input type="number"   class="input-text" placeholder="单价"  v-model.number="worklist.price"    onkeyup="onchangeneedtodoid(this.id);"  />
                                   </td>
                                     <td>
                                       <input type="number"   class="input-text" placeholder="总金额"  v-model.number="worklist.moneycount"      />
                                   </td>-->
                                <td>
                                    <div v-if="site.subinfo3.length >0"> <input type="number" id="worklist.id" class="input-text" style="width: 80px;" placeholder="包数" v-model.number="worklist.storefortype1needout" onkeyup="onchangeneedtodoid(this.id);" /></div>
                                </td>
                                <td>
                                    <div v-if="site.subinfo3.length >1"> <input type="number" id="worklist.id" class="input-text" style="width: 80px;" placeholder="包数" v-model.number="worklist.storefortype2needout" onkeyup="onchangeneedtodoid(this.id);" /></div>
                                </td>
                                <td>
                                    <div v-if="site.subinfo3.length >2"> <input type="number" id="worklist.id" class="input-text" style="width: 80px;" placeholder="包数" v-model.number="worklist.storefortype3needout" onkeyup="onchangeneedtodoid(this.id);" /></div>
                                </td>
                                <td>
                                    <input type="number" id="worklist.needtoinid" class="input-text" placeholder="有效量" v-model.number="worklist.needtoin" />
                                </td>
                                <td>
                                    <input type="number" class="input-text" style="width: 80px;" placeholder="框数" v-model.number="worklist.storeksall" />
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="mt-5 row">
                <div id="page1"></div>
            </div>

        </div>
    </div>

    <script type="text/javascript" src="../lib/layui/layui2.js"></script>
    <script type="text/javascript" src="../js/vue.min.js"></script>
    <script>
        var hcvueapp = new Vue({
            el: '#hcvueapp',
            data: {
                listinfo: []
            },
            methods: {

            }
        })
    </script>
    <script src="../hcjsui/Scripts/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="../lib/icheck/jquery.icheck.min.js"></script>
    <script type="text/javascript" src="../lib/Validform/5.3.2/Validform.js"></script>

    <script type="text/javascript" src="../lib/layui/layui.js"></script>
    <script type="text/javascript" src="../lib/layer/1.9.3/layer.js"></script>
    <script type="text/javascript" src="../lib/laypage/1.2/laypage.js"></script>
    <script type="text/javascript" src="../lib/My97DatePicker/WdatePicker.js"></script>
    <script src="../hcjsui/js/_Define.js" type="text/javascript"></script>
    <script type="text/javascript" src="../js/hcui.js"></script>
    <script type="text/javascript" src="../js/hcui_list.js"></script>

    <script type="text/javascript">
        function ymfun_fbcodeplant() {
            if ($("#findinfodt1_times").val() == "") {
                layer.msg("发货时间不能为空", { icon: 2 });
                return;
            } if ($("#findtaskfromorgid").val() == "") {
                layer.msg("请选择基地", { icon: 2 });
                return;
            }
            //分配码段
            hcapigetNoError("../api/Task/GetPlantFPCode", { "brandid": "150", "day": $("#findinfodt1_times").val(), "frombranchid": $("#findtaskfromorgid").val() }, function (backdata) {
                hcrainpage(1);
                layer.msg("处理成功，具体请查看状态及登录记录表", { icon: 4 });
            });
        }

        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });
        function opencodelist() {
            hcrainOpenDiv('入库条码明细', 'sctaskoutstoreGroup_CodeGet-ae.html?action=add&urlsettime=' + $("#findinfodt1_times").val());
        }
        hcapigetNoError("../api/Task/GetDayTask", {}, function (backdata) {
        });
        $("#testdataaddtime").val((getDateByChange(new Date(), 0)).Format("yyyy-MM-dd"));//开始时间
        function onchangeneedtodoid(htmlid) {
            console.log(htmlid);
            var id = htmlid.replace("needtodo", "").replace("kl", "").replace("needtoin", "");
            //var needtodo = $("#needtodo" + id).val();
            //var kl = $("#kl" + id).val();
            //if (needtodo == "") needtodo = 0;
            hcvueapp.listinfo.forEach(function (e) {
                var dl1 = 0;//规格重量
                var dl2 = 0;//规格重量
                var dl3 = 0;//规格重量
                if (e.subinfo3.length > 0) dl1 = e.subinfo3[0].nv1;
                if (e.subinfo3.length > 1) dl2 = e.subinfo3[1].nv1;
                if (e.subinfo3.length > 2) dl3 = e.subinfo3[2].nv1;

                e.subinfo.forEach(function (list) {
                    console.log(list.id); console.log(id);
                    if (id == list.id) {
                        //list.needtoin = (((list.needtoout * 1) / 100) * (100 - list.kl)).toFixed(2);

                        //list.moneycount = (list.needtoin * list.price).toFixed(2);
                        //return;
                        //list.storefortype1needout = (((list.storefortype1 * 1) / 100) * (100 - list.kl)).toFixed(0);
                        //list.storefortype2needout = (((list.storefortype2 * 1) / 100) * (100 - list.kl)).toFixed(0);
                        //list.storefortype3needout = (((list.storefortype3 * 1) / 100) * (100 - list.kl)).toFixed(0);
                        //根据包数 计算入库算
                        list.needtoin = (list.storefortype1needout * dl1 + list.storefortype2needout * dl2 + list.storefortype3needout * dl3).toFixed(2);

                    }

                });
            });
        }

        function getDateByChange(date, days) {
            if (days == undefined || days == '') {
                days = 1;
            }
            var date = new Date(date);
            date.setHours(date.getHours() - days);
            return date;

        }
        $("#findinfodt1_times").val(new Date().Format("yyyy-MM-dd"));
        //$("#findinfodt1_times").val((getDateByChange(new Date(), 24*2)).Format("yyyy-MM-dd"));
        //$("#findinfodt1_timee").val((getDateByChange(new Date(), 0)).Format("yyyy-MM-dd"));

        var uiform = null;
        var whereaddinfo = "";
        //基地
        hcdoselbyPost("BranchID as id,BranchName as name", "mrbranch", "type='本部'", "", "", "id", function (data) { SetSelectWithArrayIdName("#findtaskfromorgid", data); });

        $(function () {
            spsetBaseNoBt("yw_baseinfo", "id", "yw_baseinfo as T", "*", "#tablelist", "sctaskoutstore", "生产任务管理", "sctaskoutstore");
            layui.use(['form'], function () {
                uiform = layui.form();
                //人员下拉加载
                hcdoselbyPost("empid  as id,concat(depname,'-',empname) as name,empname as username,mobile as  tel,depname as address", "view_user", "branchid='" + HCUser.HCUorg + "'", "", "", "id",
                    function (data) {
                        SetSelectWithArrayIdName("#inoutusernamesel", data);
                        uiform.render();
                    });
            });

            hcrainpage(1);
        });
        //出库处理
        function savetotaskstre() {
            if ($("#testdataaddtime").val()) {

            }
            else {
                layer.msg("入库日期，不能为空", { icon: 2 });
                return;
            }
            var needupdate = 0;
            var message = "";//"<input id='ssssssssss'></input>";
            for (var sp in hcvueapp.listinfo) {
                var subinfo = hcvueapp.listinfo[sp].subinfo;
                message += "<br/> " + hcvueapp.listinfo[sp].fv1 + "[";
                for (var lindex in subinfo) {
                    //处理量要大于0
                    if (!hcisbnum(subinfo[lindex].needtoout)) {
                        continue;
                    }
                    //要是数值
                    if (!hcisnum(subinfo[lindex].storefortype1needout)) {
                        continue;
                    }
                    if (!hcisnum(subinfo[lindex].storefortype2needout)) {
                        continue;
                    }
                    needupdate++;
                    message += "(" + subinfo[lindex].needtoout + ")";
                }
                message += "]";
            }
            layer.confirm('确认信息：记录数：' + needupdate + message, {
                btn: [$("#finouttype").val(), '取消'] //按钮
            }, function () {
                savetotaskstreDo();
            }, function () {

            });
        }

        function savetotaskstreDo() {
            var outguid = NewGuid();
            var needupdate = 0;
            var updatecount = 0;

            for (var sp in hcvueapp.listinfo) {
                var subinfo = hcvueapp.listinfo[sp].subinfo;
                for (var lindex in subinfo) {
                    if (subinfo[lindex].needtoout == null || subinfo[lindex].needtoout == ""
                        || subinfo[lindex].needtoout == " " || subinfo[lindex].needtoout <= 0
                        || isNaN(subinfo[lindex].needtoout)) {
                        continue;
                    }

                    //信息通用部分
                    var addinfo = "outgid%" + outguid
                        + "$outstate%待出库处理"
                        + "$inoutstorestate%待出库处理"
                        + "$inouttype%" + $("#finouttype").val()
                        + "$outdesc%" + $("#foutdesc").val()
                        + "$dkid%" + subinfo[lindex].dkid//地ID
                        + "$dkname%" + subinfo[lindex].dkname//地编号
                        + "$taskid%" + subinfo[lindex].taskid//任务ID
                        + "$taskno%" + subinfo[lindex].taskno//任务编号
                        + "$tasklistid%" + subinfo[lindex].tasklistid//采摘记录ID
                        + "$storehouseid%0$hasoutall%0"//默认初始化
                        + "$productid%" + hcvueapp.listinfo[sp].id//品种iD
                        + "$productname%" + hcvueapp.listinfo[sp].fv1//品种名称
                        + "$storeall%" + subinfo[lindex].needtoin//入库量 needtoout
                        + "$kl%" + subinfo[lindex].kl//扣率
                        + "$storeallok%" + subinfo[lindex].needtoin//有效量
                        + "$moneycount%" + subinfo[lindex].moneycount
                        + "$price%" + subinfo[lindex].price
                        + "$storefortype1%" + subinfo[lindex].storefortype1needout
                        + "$storefortype2%" + subinfo[lindex].storefortype2needout
                        + "$storefortype3%" + subinfo[lindex].storefortype3needout
                       + "$storeksall%" + subinfo[lindex].storeksall
                        + "$taskfromorgid%" + subinfo[lindex].taskfromorgid//来原的机构
                        + "$taskfromorgname%" + subinfo[lindex].taskfromorgname//来源的机构名称
                        + "$datafromtable%hsc_task_store_out_group"//数据追溯表
                        + "$taskworktime%" + subinfo[lindex].taskworktime.Value//采摘时间
                        + "$datafromkeyid%" + subinfo[lindex].id//数据追溯ID
                        + "$productstate%" + subinfo[lindex].productstate//加工状态 原料/包装品 成品
                         + "$csgetpc%" + subinfo[lindex].csgetpc//数据追溯ID

                        + "$jjuserid%" + $("#inoutusernamesel").val()//交接人
                        + "$jjusername%" + $("#inoutusernamesel").find("option:selected").text();
                    //+ "$datafromdesc%出库";
                    // + "$productstate%" + subinfo[lindex].productstate//加工状态 原料/包装品 成品
                    if (subinfo[lindex].productstate == "原料") {
                        addinfo = addinfo + "$codecount%" + (subinfo[lindex].needtoin * 1 * hcvueapp.listinfo[sp].nv1)   //有效量*
                    }
                    else {
                        addinfo = addinfo + "$codecount%" + (subinfo[lindex].needtoin * 1 * hcvueapp.listinfo[sp].nv2)   //有效量*
                    }
                    var addinfototable = "hsc_task_store_process";

                    hcui_ajaxasync = false;
                    console.log(addinfo);
                    //出库处理-这里要禁用异步
                    addinfo = addinfo + "$dataaddtime%" + $("#testdataaddtime").val();//重指时间
                    hcdoadd2017(addinfototable, addinfo, 2, "", function (info) {
                        //更新记录
                        if (info == "ok") {
                            updatecount++;
                            hcdoedit("hsc_task_store_out_group", "id", subinfo[lindex].id, "inoutstorestate%入库中$hasoutall%hcrainself(hasoutall+" + subinfo[lindex].needtoout + ")"
                                        + "$storefortype1out%hcrainself(storefortype1out+" + subinfo[lindex].storefortype1needout + ")"
                                        + "$storefortype2out%hcrainself(storefortype2out+" + subinfo[lindex].storefortype2needout + ")"
                                        + "$storefortype3out%hcrainself(storefortype3out+" + subinfo[lindex].storefortype3needout + ")"
                                , function (info2) {
                                });
                            hcapiget("../api/Hcrain/GetUpdateCenterInTimeToBaseOut", { "id": subinfo[lindex].id, "inguid": outguid, "intime": $("#testdataaddtime").val() }, function (data) { });

                        }
                        else { layer.msg('处理过程有异常：' + info, { icon: 2 }); }
                    });
                    hcui_ajaxasync = true;
                }
            }
            layer.msg('完成操作，记录数：' + updatecount, { icon: 1 });
            //重新加载
            if (updatecount > 0) {
                hcrainpage(1);
            }


        }
        function hcrainpage(curr) {
            var sunwhereadd2 = "";
            var sunwhereadd1 = " ";
            var findtaskfromorgid = $("#findtaskfromorgid").val();
            if (findtaskfromorgid) {
                sunwhereadd1 = " and taskfromorgid=" + findtaskfromorgid;
                sunwhereadd2 = ",taskfromorgid-" + findtaskfromorgid;

            }
            if ($("#findinfodt1_times").val()) {
                sunwhereadd1 += " and dataaddtime>='" + $("#findinfodt1_times").val() + " 00:00:00'";
                sunwhereadd2 += ",dataaddtime-||>=||" + $("#findinfodt1_times").val() + " 00:00:00";
            }
            if ($("#findinfodt1_times").val()) {
                sunwhereadd1 += " and dataaddtime<='" + $("#findinfodt1_times").val() + " 23:59:59'";
                sunwhereadd2 += ",dataaddtime-||<=||" + $("#findinfodt1_times").val() + " 23:59:59";
            }
            else {
                sunwhereadd1 += " and dataaddtime<='" + $("#findinfodt1_times").val() + " 23:59:59'";
                sunwhereadd2 += ",dataaddtime-||<=||" + $("#findinfodt1_times").val() + " 23:59:59";
            }
            var finddcno = $("#findfv1").val();
            if (finddcno) {
                whereaddinfo = " and fv1 like '%" + finddcno + "%'";
            }
            else { whereaddinfo = ""; }

            if (!$("#c_dcinfo").is(':checked')) {
                sunwhereadd2 += ",inoutstorestate-||!=||待质检";
                sunwhereadd1 += " and inoutstorestate in ('待入库', '入库中') ";
            }
            else {
                sunwhereadd1 += " and inoutstorestate in ('待入库', '入库中','待质检') ";
            }


            $.ajax({
                type: "post",
                url: "../ashx/spui.ashx",
                data: {
                    "action": "getpageinfo",
                    "pagenow": curr || 1,
                    "pagesize": 50,
                    "select": "t.id,t.fv1,t.fv2,0 as storeall,nv1,nv2",
                    "table": "yw_baseinfo as t",
                    "group": "",
                    "having": "",
                    "where": " type=1 and maintype=1 " + whereaddinfo + " and id in(select productid from hsc_task_store_out_group where    inouttype in('发往加工中心','发货记录登记') " + sunwhereadd1 + " and storeall>hasoutall)",//有库存的
                    "order": "",
                    "subinfo": "hasplantcode,csgetpc,storeksall,moneycount,0 price,storefortype1,storefortype2,storefortype3,storefortype1out,storefortype2out,storefortype3out,storefortype1-storefortype1out as storefortype1needout ,storefortype2-storefortype2out as storefortype2needout,storefortype3-storefortype3out as storefortype3needout," +
                        "CONCAT('needtodo',id) as needtodoid,CONCAT('kl',id) as klid,CONCAT('needtoin',id) as needtoinid,kl,storeall-hasoutall as needtoin,id,inoutstorestate,taskfromorgid,taskfromorgname,taskid,taskno,tasklistid,productname,dkid,dkname,dataaddtime,storeall,storeall-hasoutall as needtoout,lockcout,hasoutall,outstate,taskworktime,productstate#hsc_task_store_out_group#productid-@id,inouttype-||in||HcrDJHHcr发往加工中心HcrDJHHcr(HcrDHHcr)HcrDJHHcr发货记录登记HcrDJHHcr" + sunwhereadd2 + ",storeall-||>||@@hasoutall#id#",//子查询   当前物品+当前机构+库存大于0
                    "subinfo2": "id,fv1,fv2,fv3,nv1,nv2,nv3#yw_baseinfo#type-11,fv1-@id,databranchid-" + HCUser.HCUorg + "#nv2#",//当前机构+7+当前品种的扣率
                    "subinfo3": "id,fv1,fv2,fv3,nv1,nv2,nv3#yw_baseinfo#type-7,fv1-@id#nv2#"//7+当前品种规格

                },
                async: true,
                cache: false,
                error: function (error) {

                },
                success: function (data) {
                    var result = JSON.parse(data);
                    hcvueapp.listinfo = result.data;
                    //if (hcvueapp.listinfo == null || hcvueapp.listinfo.length == 0) {
                    //    result.message = "没有数据"; /// / / layer.msg('没有相关数据噢', { icon: 5 });
                    //}
                    //var kl = 0;
                    //hcvueapp.listinfo.forEach(function (e) {
                    //    kl = 0;
                    //    e.subinfo2.forEach(function (list) {//取扣率
                    //        kl = list.nv1;
                    //    });
                    //    e.subinfo.forEach(function (list1) {//设置扣率
                    //        list1.kl = kl;
                    //    });
                    //});

                    hcvueapp.listinfo.forEach(function (e) {//有效量
                        var dl1 = 0;//规格重量
                        var dl2 = 0;//规格重量
                        var dl3 = 0;//规格重量
                        if (e.subinfo3.length > 0) dl1 = e.subinfo3[0].nv1;
                        if (e.subinfo3.length > 1) dl2 = e.subinfo3[1].nv1;
                        if (e.subinfo3.length > 2) dl3 = e.subinfo3[2].nv1;
                        e.subinfo.forEach(function (list) {
                            //list.needtoin = (((list.needtoout * 1) / 100) * (100 - list.kl)).toFixed(2);
                            list.storefortype1needout = (((list.storefortype1 * 1) / 100) * (100 - list.kl)).toFixed(0);
                            list.storefortype2needout = (((list.storefortype2 * 1) / 100) * (100 - list.kl)).toFixed(0);
                            list.storefortype3needout = (((list.storefortype3 * 1) / 100) * (100 - list.kl)).toFixed(0);
                            hcvueapp.listinfo.forEach(function (e) {//有效量
                                e.subinfo.forEach(function (list) {
                                    list.needtoin = (((list.needtoout * 1) / 100) * (100 - list.kl)).toFixed(2);
                                });
                            });
                            //根据包数 计算入库算
                            //list.needtoin = (list.storefortype1needout * dl1 + list.storefortype2needout * dl2 + list.storefortype3needout * dl3).toFixed(2);
                        });
                    });
                    //计算总量
                    hcvueapp.listinfo.forEach(function (e) {
                        e.subinfo.forEach(function (list) {
                            e.storeall = (e.storeall * 1 + (list.storeall * 1 - list.hasoutall * 1)).toFixed(2);
                        });
                    });

                    //显示分页
                    laypage({
                        cont: 'page1', //容器。值支持id名、原生dom对象，jquery对象。【如该容器为】：<div id="page1"></div>
                        pages: result.message || 0, //通过后台拿到的总页数
                        curr: curr || 1, //当前页
                        jump: function (obj, first) { //触发分页后的回调
                            if (!first) { //点击跳页触发函数自身，并传递当前页：obj.curr
                                hcrainpage(obj.curr);
                            }
                        }
                    });

                }
            });
        };

        //重新加载-重载
        function findreolad(isback) {
            hcrainpage(1);
        }
    </script>
</body>
</html>
